import { defineConfig,loadEnv } from 'vite'
import vue from '@vitejs/plugin-vue'
import { resolve } from 'path'


export default ({ mode }) => {
  process.env = { ...process.env, ...loadEnv(mode, process.cwd()) };
  
  return defineConfig({
    plugins: [vue()],
    // base: './',
    build: {
      cssCodeSplit: false, //默认ture,将css分割提取到css文件中，false将全部css提取到一个文件里
    },
    resolve: {
      alias: {
        '@': resolve(__dirname, './src')
      }
    },
    define: {
      'process.env': {}
    },
    outDir: 'dist',
    server: {
      port: 3000,
      hmr:true, //开启热更新
    }
  })
}

